/*
 *  hihocoder.com
 *
 *  Category: balanced binary tree
 */

/*-------- Includes --------*/
#include <set>
#include <iomanip>
#include <iostream>
#include <algorithm>

using namespace std;

/*-------- Defines --------*/


/*-------- Types --------*/


/*-------- Global Variables --------*/


/*-------- Function Prototypes --------*/


/*-------- Main Function --------*/
int main(int argc, char const *argv[])
{
    int size   = 0;
    int median = 0;
    multiset<int> lset, rset;

    multiset<int>::iterator l, r;

    char opt;
    int  x;
    int  N;

    cin >> N;

    while (N--) {
        cin >> opt >> x;

        if (opt == 'A') {   // add an element
            if (size % 2) { // when size is odd
                if (x < median) {
                    lset.insert(x);
                    rset.insert(median);
                } else {
                    lset.insert(median);
                    rset.insert(x);
                }

                l = lset.end(); --l;
                r = rset.begin();

                median = *l + *r;
            } else {        // when size is even
                if ((x << 1) < median) {
                    lset.insert(x);

                    l = lset.end(); --l;

                    median = *l;

                    lset.erase(l);
                } else {
                    rset.insert(x);

                    r = rset.begin();

                    median = *r;

                    rset.erase(r);
                }
            }

            ++size;
        } else {    // remove an element
            if (size == 0) continue;

            if (size % 2) { // when size is odd
                if (x == median) {
                    l = lset.end(); --l;
                    r = rset.begin();

                    median = *l + *r;
                    --size;
                } else if (x < median) {
                    if ((l = lset.find(x)) != lset.end()) {
                        lset.erase(l);

                        lset.insert(median);

                        r = rset.begin();

                        median += *r;
                        --size;
                    }
                } else {
                    if ((r = rset.find(x)) != rset.end()) {
                        rset.erase(r);

                        rset.insert(median);

                        l = lset.end(); --l;

                        median += *l;
                        --size;
                    }
                }
            } else {        // when size is even
                if ((x << 1) < median) {
                    if ((l = lset.find(x)) != lset.end()) {
                        lset.erase(l);

                        r = rset.begin();
                        median = *r;
                        rset.erase(r);

                        --size;
                    }
                } else {
                    if ((r = rset.find(x)) != rset.end()) {
                        rset.erase(r);

                        l = lset.end(); --l;
                        median = *l;
                        lset.erase(l);

                        --size;
                    }
                }
            }
        }

        if (size % 2) {
            cout << median << endl;
        } else {
            if (median % 2)
                cout << (median >> 1) << ".5" << endl;
            else
                cout << (median >> 1) << endl;
        }
    }

    return 0;
}

/*-------- Functions --------*/

